Migrate CruiseControlMetricsReporterTest to TestContainers#2303
Migrate CruiseControlMetricsReporterTest to TestContainers#2303CCisGG merged 2 commits intolinkedin:mainfrom
Conversation
dbf97d8 to
e0b2cb3
Compare
|
@kyguy The idea looks good to me. It would be super helpful if you could find some reviewers, and I'll give a +1 once this get reviewed. Thanks! |
|
Hoping to tap into your expertise in Cruise Control and/or TestContainers, would you mind taking a look at this when you get a chance? CC @ppatierno @fvaleri @ShubhamRwt @tomncooper @mimaison @see-quick @k-wall |
see-quick
left a comment
There was a problem hiding this comment.
Looks good to me 👍. I have just a few comments to consider.
mimaison
left a comment
There was a problem hiding this comment.
Thanks for the PR! I left a few suggestions and comments
2147a3c to
1057e9f
Compare
mimaison
left a comment
There was a problem hiding this comment.
Thanks for the updates. I made another pass
79e4175 to
b8b8fd4
Compare
mimaison
left a comment
There was a problem hiding this comment.
Thanks for the updates! It's looking better, I just left a few more comments.
e1284ad to
b64ca60
Compare
|
Thanks for the updates. It looks like the latest changes have broken a test: |
adc1908 to
e168254
Compare
61bd8c3 to
13e8342
Compare
k-wall
left a comment
There was a problem hiding this comment.
One final nit, but otherwise LGTM
|
Hey @CCisGG this PR has been tested, reviewed, and is ready to go! |
Signed-off-by: Kyle Liberti <kliberti.us@gmail.com>
8b1bb0c to
e2c328e
Compare
|
Hi @CCisGG, if you don’t have any objections, would you be okay with merging this PR? |
danielgospodinow
left a comment
There was a problem hiding this comment.
Took a shallow first look at the PR and left some comments. I'll revisit the PR soon to see if I can find anything deeper.
Btw, this is a fantastic initiative, IMO. Kudos for the effort!
| // Selects or creates the Docker network used for Test Container communication. | ||
| // This is useful in CI environment like CircleCI where the Docker network needs to be shared with Test Container client. | ||
| private static final Network NETWORK = System.getenv("NETWORK_NAME") != null | ||
| ? Network.builder().id(System.getenv("NETWORK_NAME")).build() |
There was a problem hiding this comment.
FWIW, setting the network ID using id(name) seems to be deprecated. 🤔
There was a problem hiding this comment.
Yes, id(name) has been deprecated but it is required for connecting CircleCI jobs to TestContainer services. This is something I need to chase up with the TestContainers and CircleCI communities so we don't lose this functionality in the future or are presented an alternative path forward. I'll link an issue here.
| no_output_timeout: 15m | ||
| command: ./gradlew --no-daemon -PmaxParallelForks=1 build | ||
| command: | | ||
| export NETWORK_NAME="test_containers_network" |
There was a problem hiding this comment.
Is it mandatory to create and pass down NETWORK_NAME and CONTAINER_HOST?
If everything works fine without those two (in case the framework creates its own ephemeral resources), I'd personally prefer not having them for the sake of simplicity.
There was a problem hiding this comment.
Reading the comments in CCContainerizedKraftCluster kind of explained the situation. It's basically good to have for CI. But I'm still not sure if it's mandatory or just good to have.
There was a problem hiding this comment.
Unfortunately, these variables are mandatory for allowing the CircleCI job to find/connect to the containers created by TestContainers. I have just added some comment/Javadocs to make this more clear. Let me know what you think!
There was a problem hiding this comment.
Got it. Makes sense. And the docs explain it well now. Thanks!
| EXTERNAL_LISTENER_NAME + "://0.0.0.0:" + CONTAINER_EXTERNAL_LISTENER_PORT | ||
| ); | ||
| this._bootstrapServers = generateBootstrapServersList(numOfBrokers, containerHostPorts); | ||
| adminClientProps.setProperty(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, _bootstrapServers); |
There was a problem hiding this comment.
It's slightly odd that we're mutating an externally provided object that is only used here. It can cause side effects. Why not just craft the adminClientProps here in the constructor?
There was a problem hiding this comment.
Or maybe we can pass a clone of adminClientProps.
There was a problem hiding this comment.
Or just have JavaDoc that mentions this behavior clearly.
There was a problem hiding this comment.
Cloned it in the constructor and added a note in the latest commit, let me know if this will suffice!
Signed-off-by: Kyle Liberti <kliberti.us@gmail.com>
…2303) * Migrate CruiseControlMetricsReporterTest to TestContainers Signed-off-by: Kyle Liberti <kliberti.us@gmail.com> * Addressing feedback - gp Signed-off-by: Kyle Liberti <kliberti.us@gmail.com> --------- Signed-off-by: Kyle Liberti <kliberti.us@gmail.com>
…2303) * Migrate CruiseControlMetricsReporterTest to TestContainers Signed-off-by: Kyle Liberti <kliberti.us@gmail.com> * Addressing feedback - gp Signed-off-by: Kyle Liberti <kliberti.us@gmail.com> --------- Signed-off-by: Kyle Liberti <kliberti.us@gmail.com>
…2303) * Migrate CruiseControlMetricsReporterTest to TestContainers Signed-off-by: Kyle Liberti <kliberti.us@gmail.com> * Addressing feedback - gp Signed-off-by: Kyle Liberti <kliberti.us@gmail.com> --------- Signed-off-by: Kyle Liberti <kliberti.us@gmail.com>
…2303) * Migrate CruiseControlMetricsReporterTest to TestContainers Signed-off-by: Kyle Liberti <kliberti.us@gmail.com> * Addressing feedback - gp Signed-off-by: Kyle Liberti <kliberti.us@gmail.com> --------- Signed-off-by: Kyle Liberti <kliberti.us@gmail.com>
Summary
Why: As detailed in issue Migrate off internal Kafka APIs to Improve Compatibility and Maintainability #2282, the existing Cruise Control tests rely on the Kafka server wrapper class,
CCEmbeddedBroker, which uses several non-public Kafka APIs. These internal APIs lack stability and compatibility guarantees, making it increasingly difficult to upgrade Kafka versions. As Kafka evolves, this reliance introduces upgrade friction, version lock-in, and a growing maintenance burden.What: This PR starts the migration of the Cruise Control tests away from internal Kafka APIs by refactoring the
CruiseControlMetricsReporterTestto replace its dependency on theCCEmbeddedBrokerclass with the TestContainers Kafka module instead. This helps future-proof Cruise Control by easing upgrades to newer Kafka versions, expanding Kafka versions compatibility, and reducing the ongoing maintenance overhead.If an approach looks good, passes review, and is merged, we can continue migrating the remaining test classes incrementally, one PR at a time, until we completely remove the dependency on private Kafka APIs in the Cruise Control tests.
Categorization
This PR partially resolves #2282